
#include"common.hpp"
#include"Inetaddr.hpp"
#include"Tcpserver.hpp"
#include"Http.hpp"



void User(const char* agrv)
{
    std::cout<<"User should: "<< agrv <<" port"<<std::endl;
    exit(USER_ERR);
}

int main(int argc,char* argv[])
{
    if(argc != 2)
    {
        User(argv[0]);
    }
    uint16_t port = std::stoi(argv[1]);
    
        

    std::unique_ptr<Http> http = std::make_unique<Http>();

    std::unique_ptr<Tcpserver> tcpser = std::make_unique<Tcpserver>(port,[&http](std::shared_ptr<TcpSocket> stcp,Inetaddr& addr){
        http->GetRequstHttp(stcp);
        
    });

    tcpser->Start();


    return 0;
}